package com.zjgsu.nftplatform.util;

import org.apache.shiro.SecurityUtils;

/**
 * @author ahy231
 * @date 2021/11/26 0:57
 * @description
 */
public class RoleUtil {
    public static void haveRoles(String... roles) {
        SecurityUtils.getSubject().checkRoles(roles);
    }

    public static Boolean haveOneRole(String... roles) {
        for (String role :
                roles) {
            try {
                SecurityUtils.getSubject().checkRole(role);
                return true;
            } catch (Exception ignored) {
            }
        }
        return false;
    }
}
